Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
kissgyorgy / listen.py
Created September 4, 2020 16:37
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")
@willglynn
willglynn / doc.md
Created November 1, 2023 00:18
Change SMBIOS UUID on AMI firmware PCs

PCs have SMBIOS data containing small amount of identifying information. One piece of information in this SMBIOS data is the universally unique identifier. Some PC and motherboard manufacturers fail to set this, often leaving the UUID set to 03000200-0400-0500-0006-000700080009.

If your system uses an AMI firmware (sometimes called AMIBIOS), you may be able to use AMI utilities to reset the UUID. Obtain AMIDEEFIx86.efi and an EFI shell executable, such as from inside m1ujt73usa.zip for the Lenovo ThinkStation P330 Tiny download center.

Once you have those two files, create USB drive with the FAT32 filesystem and the following structure:

\
  \AMIDEEFIx86.efi
  \efi
@n-ce
n-ce / YTM_Clients_FOSS_Android.md
Last active November 5, 2026 12:04
YouTube Music clients on Android
@std-microblock
std-microblock / main.md
Last active November 5, 2026 12:03
关于"小米反诈监控"传闻的技术核验

结论

传闻中"系统内置反诈数据库、记录截屏时间与通话、屏幕共享行为"这部分属实;"域名用途"部分与实际不符;"GuardProvider 静默录屏"在部分机型上属实;"关掉开关仍在运行""卸载 GuardProvider 无效"属实;"669 次连续读写""每台手机都在录"不成立。


一、功能名称与开关位置

传闻描述的行为属于手机管家中的"电诈防护",不是独立的后台程序。

@mmoellg
mmoellg / 4-Variants-of-Running-Median-over-a-Fixed-Size-Window-of-a-Data-Stream.txt
Last active November 5, 2026 11:58
LEAN ALGORITHM: Running Median over a Fixed-Size Window of a Data-Stream -4 variants
/*
LEAN ALGORITHM: Running Median over a Fixed-Size Window of a Stream - 4 Variants
The four variants has been published on Zenodo.org:
#1 ¦ Basic Insertion Sort : https://doi.org/10.5281/zenodo.23601248
#2 ¦ Optimized Insertion Sort : https://doi.org/10.5281/zenodo.23626176
#3 ¦ Basic Nonsorting : https://doi.org/10.5281/zenodo.23670710
#4 ¦ Optimized Nonsorting : https://doi.org/10.5281/zenodo.23671391
Published with full C source code provided under the terms of the MIT License.
@ben-vargas
ben-vargas / amp-cliproxyapi-setup.md
Last active November 5, 2026 11:58
Amp Orbs Running CLIProxyAPI + Amp Router Custom URL

Amp Orbs Running CLIProxyAPI + Amp Router Custom URL

This guide runs CLIProxyAPI in an Amp orb around the clock and publishes it at a stable public HTTPS URL through Tailscale Funnel. An Amp Custom URL model-routing connection then sends Claude requests there, and CLIProxyAPI serves them with your Claude Pro or Max subscription (OAuth login) instead of Amp credits.

The host scripts, templates, and an agent skill that walks you through every step live in ben-vargas/amp-plugins/skills/amp-cli-proxy-api. The easiest path is to install the skill and ask Amp to set it up:

amp skill add --global ben-vargas/amp-plugins/skills/amp-cli-proxy-api
@Snehil-Shah
Snehil-Shah / libresprite-svg.js
Created August 2, 2025 10:59
Export entire LibreSprite sprite as an svg. WARNING: This script flattens all layers of the sprite before saving. Make sure to save your work before running this script and later undo the flattening if needed.
/**
* This is a modified work of the original script by smol artist guy.
*
* Source: https://www.youtube.com/watch?v=TaJAeD5hxQY
*/
/**
* Save entire sprite as SVG.
*
* WARNING: This script flattens all layers of the sprite before saving. Make sure to save your work before running this script and later undo the flattening if needed.

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@bobbypaton
bobbypaton / pymol_style.py
Last active November 5, 2026 11:47
Create high quality ball-and-stick molecular images with Pymol and other things like ESP surfaces and spin density plots
# BallnStick creates a ball and stick representation of an object
# Add_VDW creates a copy of an object with full-sized, transparent spheres
# Bondi VDW values added below to override default Pymol settings
from pymol import cmd
from pymol import stored
# Bondi VDW values
cmd.alter("elem Ac", "vdw=2.00")
cmd.alter("elem Al", "vdw=2.00")
cmd.alter("elem Am", "vdw=2.00")
cmd.alter("elem Sb", "vdw=2.00")